<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <!-- 1. 添加视口 -->
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>商品列表</title>
    <!-- 2. 引包 -->
    <!-- 1. 引入mui的CSS -->
    <link rel="stylesheet" href="lib/mui/css/mui.css">
    <!-- 2. 引入字体图标的CSS -->
    <link rel="stylesheet" href="lib/fontAwesome/css/font-awesome.css">
    <!-- 3. 引入商品列表的less文件 -->
    <link rel="stylesheet/less" href="less/productlist.less">
    <!-- 4. 引入less.js编译器文件 -->
    <script src="lib/less/less.js"></script>
    <!-- 5. 在页面前引入rem.js 等页面加载出来之前生效样式马上执行 -->
    <script src="js/rem.js"></script>
</head>

<body>
    <!-- 头部区域 -->
    <header id="header">
        <!-- javascript:history.back(); 使用历史记录的返回上一页的函数 -->
        <a href="javascript:history.back();" class="fa fa-arrow-left"></a>
        <h4>商品列表</h4>
    </header>
    <!-- 主体区域 -->
    <main id="main">
        <!-- 添加一个区域滚动的父容器 -->
        <div id="refreshContainer" class="mui-scroll-wrapper">
            <!-- 添加一个区域滚动的子容器 -->
            <div class="mui-scroll">
                <!-- 搜索表单 -->
                <div class="search-form">
                    <form action="#">
                        <input type="search" placeholder="请输入要搜索商品" class="input-search">
                        <button type="button" class="mui-btn mui-btn-primary btn-search">搜索</button>
                    </form>
                </div>
                <!-- 商品列表 -->
                <div class="product-list">
                    <div class="title">
                        <!-- .mui-row>.mui-col-xs-3*4>a[href="#"]>span{上架时间}+i.fa.fa-angle-down -->
                        <div class="mui-row">
                            <div class="mui-col-xs-3 active"><a href="#"><span>上架时间</span><i class="fa fa-angle-down"></i></a></div>
                            <!-- 1. 把价格排序的方式 和 排序的顺序 存储到自定义属性中 -->
                            <div class="mui-col-xs-3"><a href="#" data-sort-type="price" data-sort="1"><span>价格</span><i class="fa fa-angle-down"></i></a></div>
                            <!-- 1. 把数量排序的方式 和 排序的顺序 存储到自定义属性中 -->
                            <div class="mui-col-xs-3"><a href="#" data-sort-type="num" data-sort="1"><span>销量</span><i class="fa fa-angle-down"></i></a></div>
                            <div class="mui-col-xs-3"><a href="#"><span>折扣</span><i class="fa fa-angle-down"></i></a></div>
                        </div>
                    </div>
                    <div class="content">
                        <div class="mui-row product-box">
                            <div class="mui-col-xs-6 left">
                                <a href="#">
                                    <img src="images/product.jpg" alt="">
                                    <p class="product-name">adidas阿迪达斯 男式 场下休闲篮球鞋S83700</p>
                                    <p class="product-price">
                                        <span>￥566.00</span>
                                        <del>￥888.00</del>
                                    </p>
                                    <button type="button" class="mui-btn mui-btn-primary product-buy">立即购买</button>
                                </a>
                            </div>
                            <div class="mui-col-xs-6 left">
                                <a href="#">
                                    <img src="images/product.jpg" alt="">
                                    <p class="product-name">adidas阿迪达斯 男式 场下休闲篮球鞋S83700</p>
                                    <p class="product-price">
                                        <span>￥566.00</span>
                                        <del>￥888.00</del>
                                    </p>
                                    <button type="button" class="mui-btn mui-btn-primary product-buy">立即购买</button>
                                </a>
                            </div>
                            <div class="mui-col-xs-6 left">
                                <a href="#">
                                    <img src="images/product.jpg" alt="">
                                    <p class="product-name">adidas阿迪达斯 男式 场下休闲篮球鞋S83700</p>
                                    <p class="product-price">
                                        <span>￥566.00</span>
                                        <del>￥888.00</del>
                                    </p>
                                    <button type="button" class="mui-btn mui-btn-primary product-buy">立即购买</button>
                                </a>
                            </div>
                            <div class="mui-col-xs-6 left">
                                <a href="#">
                                    <img src="images/product.jpg" alt="">
                                    <p class="product-name">adidas阿迪达斯 男式 场下休闲篮球鞋S83700</p>
                                    <p class="product-price">
                                        <span>￥566.00</span>
                                        <del>￥888.00</del>
                                    </p>
                                    <button type="button" class="mui-btn mui-btn-primary product-buy">立即购买</button>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
    <!-- 底部区域 -->
    <footer id="footer">
        <div class="mui-row">
            <!-- .mui-col-xs-3*4>a[href="#"]>i.fa.fa-home+span{首页} -->
            <div class="mui-col-xs-3 ">
                <a href="index.html"><i class="fa fa-home"></i><span>首页</span></a>
            </div>
            <div class="mui-col-xs-3">
                <a href="category.html" class="active"><i class="fa fa-bars"></i><span>分类</span></a>
            </div>
            <div class="mui-col-xs-3">
                <a href="cart.html"><i class="fa fa-shopping-cart"></i><span>购物车</span></a>
            </div>
            <div class="mui-col-xs-3">
                <a href="user.html"><i class="fa fa-user"></i><span>个人中心</span></a>
            </div>
        </div>
    </footer>
    <!-- 遮罩层 -->
    <div class="mask">
        <!-- 加载中效果的结构 -->
        <div class="spinner">
            <div class="spinner-container container1">
                <div class="circle1"></div>
                <div class="circle2"></div>
                <div class="circle3"></div>
                <div class="circle4"></div>
            </div>
            <div class="spinner-container container2">
                <div class="circle1"></div>
                <div class="circle2"></div>
                <div class="circle3"></div>
                <div class="circle4"></div>
            </div>
            <div class="spinner-container container3">
                <div class="circle1"></div>
                <div class="circle2"></div>
                <div class="circle3"></div>
                <div class="circle4"></div>
            </div>
        </div>
    </div>
    <script id="productlistTpl" type="text/html">
        {{if data.length > 0}}
            {{each data value}}
            <div class="mui-col-xs-6 left">
                <a href="#">
                    <!-- 图片是一个数组 需要数组中第一个图片的图片地址 -->
                    <img src="{{value.pic[0].picAddr}}" alt="">
                    <p class="product-name">{{value.proName}}</p>
                    <p class="product-price">
                        <span>￥{{value.price}}</span>
                        <del>￥{{value.oldPrice}}</del>
                    </p>
                    <button type="button" class="mui-btn mui-btn-primary product-buy" data-id="{{value.id}}">立即购买</button>
                </a>
            </div>
            {{/each}} 
        {{else}}
        <p>当前商品没有库存了！</p>
        {{/if}}
    </script>
    <!-- 1. 引入mui的JS -->
    <script src="lib/mui/js/mui.js"></script>
    <!-- 2. 引入模板引擎的 注意引入template-web.js 最新版最简洁的  -->
    <script src="lib/artTemplate/template-web.js"></script>
    <!-- 3. 引入zepto的JS ajax dom操作的Js库 -->
    <script src="lib/zepto/zepto.min.js"></script>
    <!-- 4. 引入商品列表的JS文件 -->
    <!-- <script src="js/productlist标准版.js"></script> -->
    <script src="js/productlist.js"></script>
</body>

</html>
